export interface Function {
  groupId: string;
  groupName: string;
  groupDisplayName: string;
  functionName: string;
  functionId: string;
  regionCode: string;
  regionName: string;
  description: string;
  memorySize: number;
  timeout: number;
  environment: string[];
  envs: string;
  runtime: string;
  handler: string;
  concurrency: number;
  reserveNumber: number;
  createTime: string;
  updateTime: string;
  deleteTime: string;
  enablePublic: number;
  runtimeShow: string;
  versionId: string;
  versionName: string;
  status: string;
  enableVpc: boolean;
  vpcInfo: object;

  containerImage: string,
  containerTag: string,
  containerCommand: string,
  containerArgs: string,
  containerPort: string,

  isInitialize: boolean,
  initializeHandler: string,
  initializeTimeout: number,
}
export interface Group {
  id: string;
  name: string;
  displayName: string;
  regionCode: string;
  regionName: string;
  description: string;
  createTime: string;
  updateTime: string;
  deleteTime: string;
}
export interface InvokeResult {
  //   Log: string;
  //   billDuration: number;
  //   invokeDuration: number;
  //   errMsg: string;
  //   invokeResult: number;
  //   retMsg: string

  log: string;
  memoryUsage: number;
  requestId: string;
  returnCode: number;
  returnMsg: string; // 执行结果
  runtimeDuration: number;
  checksum: string;
}

export interface Variable {
  key: string;
  value: string;
}

export interface Trigger {
  id: string;
  groupId: string;
  groupName: string;
  funcId: string;
  funcName: string;
  regionCode: string;
  regionName: string;
  name: string;
  type: string;
  config: string;
  param: string;
  isEnable: number;
  targetType: number;
  targetId: string;
  targetName: string;
  createTime: string;
  updateTime: string;
  deleteTime: string;
}

export interface Metric {
  time: string;
  data: number;
}

export interface UploadParam {
  date: string;
  codeSignedStr: string;
  codeUrl: string;
  checkSignedStr: string;
  checkUrl: string;
}

export class FunctionCreation {
  regionCode: string; //regionId
  groupId: string;//应用id
  functionName: string;
  description: string;
  runtime: string;//运行环境
  handler: string; //函数入口
  memorySize: number;//函数运行内存
  timeout: number; //超时时间
  concurrency: number; //单实例并发数量
  upload: string;//代码上传方式
  fileName: string;//上传文件名
}

export class Region {
  regionCode: string;
  regionName: string;
}

export interface PublishVersionRes {
  success: boolean;
  versionName: string;
}

export interface Alias {
  groupId: string;
  funcId: string;
  aliasId: string;
  aliasName: string;
  description: string;
  rule: Rule;
}

export interface Rule {
  type: string;
  traffic: Array<OptionalRule>;
}

export interface OptionalRule {
  versionName: string;
  versionWeight: number;
}

export interface VersionsGettingRes {
  success: boolean;
  versions: Array<any>;
}

export interface AliasRes {
  success: boolean;
  alias: Array<any>;
}

export interface EnvVariable {
  id: string;
  key: string;
  value: string;
}
